<template>
  <div class="tpen">
    <el-form :inline="true" :model="formInline" class="demo-form-inline">
      <el-form-item label="会员">
        <el-input v-model="listQuery.user_name" size="mini" placeholder="会员名、手机号"></el-input>
      </el-form-item>
      <el-form-item label="时间">
        <el-date-picker
          size="mini"
          value-format="yyyy-MM-dd"
          v-model="listQuery.date"
          type="daterange"
          range-separator="至"
          start-placeholder="开始日期"
          end-placeholder="结束日期">
        </el-date-picker>
      </el-form-item>
      <el-form-item>
        <el-button size="mini" type="primary" @click="search">查询</el-button>
      </el-form-item>
    </el-form>
    <el-table :data='list' @row-click='getDetail' v-loading="loading" stripe fit highlight-current-row style="width: 100%">
      <el-table-column  label="会员名">
        <template slot-scope="scope">
          <span>{{scope.row.user.name}}</span>
        </template>
      </el-table-column>

      <el-table-column
          prop=""
          label="头像">
          <template slot-scope="scope">
            <img :src="scope.row.user.avatar" width="50px" alt="">
          </template>
      </el-table-column>

      <el-table-column  label="店铺名">
        <template slot-scope="scope">
          <span>{{scope.row.paid_at}}</span>
        </template>
      </el-table-column>

      <el-table-column label="店铺标题">
        <template slot-scope="scope">
          <span>{{scope.row.paid_at}}</span>
        </template>
      </el-table-column>

      <el-table-column label="提现金额">
        <template slot-scope="scope">
          <span>{{scope.row.order_amount_total}}</span>
        </template>
      </el-table-column>

      <el-table-column  label="银行卡号">
        <template slot-scope="scope">
          <span>{{scope.row.order_amount_total}}</span>
        </template>
      </el-table-column>

      <el-table-column  label="店铺账户余额">
        <template slot-scope="scope">
          <span>{{scope.row.order_amount_total}}</span>
        </template>
      </el-table-column>
      
      <el-table-column label="提现时间">
        <template slot-scope="scope">
          <span>{{scope.row.order_amount_total}}</span>
        </template>
      </el-table-column>
    </el-table>

    <div class="pagination-container">
      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="listQuery.page"
        :page-sizes="[10, 20, 50]"
        :page-size="pageMeta.limit"
        background
        layout="total, sizes, prev, pager, next, jumper"
        :total="pageMeta.total">
      </el-pagination>
    </div>

  </div>
</template>

<script>
import { getTX } from '@/api/order'

export default {
  props: {
    type: {
      type: String,
      default: 'all'
    }
  },
  data() {
    return {
      list: null,
      pageMeta: {
        total: 0,
        size: 15
      },
      listQuery: {
        page: 1,
        date: '',
        limit: 15,
        status: '',
        order_no: 0,
        user_name: ''
      },
      formInline: {
        user: '',
        region: ''
      },
      loading: false
    }
  },
  filters: {
  },
  created() {
    const status = {
      'all': '',
      'pending_payment': 0,
      'pending_delivery': 1,
      'shipped': 2,
      'completed': 3,
      'close': 7
    }
    this.listQuery.status = status[this.type]
    this.getList()
  },
  methods: {
    getList() {
      getTX(this.listQuery).then(response => {
        this.list = response.data.data
        this.pageMeta.total = response.data.total
        this.loading = false
      })
    },
    handleSizeChange(val) {
      this.listQuery.limit = val
    },
    handleCurrentChange(val) {
      this.listQuery.page = val
      this.getList()
    },
    // 获取订单ID查询订单详细信息用
    getDetail(order) {
      this.$emit('orderId', order.id)
    },
    search() {
      this.getList()
    }
  }
}
</script>
<style>
.tpen .el-table tr {
  cursor: pointer;
}
</style>

<style lang="scss" scoped>
.el-form-item {
  margin-bottom: 10px;
}
.slidepanel-box {
  display: table;
  margin-top: 8px;
  font-size: 14px;
  .slidepanel-box-left ,
  .slidepanel-box-right {
    display: table-cell;
    vertical-align: top;
    text-align: left;
    img {
      border-radius: 0px;
      max-width: 80px;
      max-width: 80px;
    }
  }
  .slidepanel-box-left {
    padding-right: 8px;
  }
  .slidepanel-box-right {
    width: 10000px;
    overflow: hidden;
    line-height: 1.45;
    .p-item-sub {
      color: #76838f;
    }
    .p-dec {
      float: right;
      padding-right: 10px;
      font-size: 12px;
      text-align: right;
      color: #888;
      p {
        line-height: 1;
        margin: 0;
      }
    }
  }
}
.pagination-container {
  margin-top: 30px;
}
.el-tag--default {
  color: #606266;
  background:transparent;
  border-color: #e4eaec;
}
</style>


